using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Linq;
using DevExpress.XtraReports.UI;
using System.Collections.Generic;

namespace QLTV.Reports
{
    public partial class rptOffSigner : DevExpress.XtraReports.UI.XtraReport
    {
        public rptOffSigner()
        {
            InitializeComponent();
           
        }
         Database.dsReport dsReport2 ;
        public void loadData(List<string> listCrewID)
        {
            //off signer
            dsReport2 = new Database.dsReport();
            Database.dsReportTableAdapters.tadCrewImmigration tadImm = new Database.dsReportTableAdapters.tadCrewImmigration();
            tadImm.Fill(dsReport2.CrewImmigration);
           IList OffCrewList = (from c in dsReport2.CrewImmigration.AsQueryable ()
                                 where listCrewID.Contains(c.nCrewId)
                                 select new
                                 {
                                     nCrewId = c.nCrewId,
                                     cRankName = c.cRankName,
                                     FullName = c.FullName,
                                     dDateOfBirth = (c.IsdDateOfBirthNull() ? null : c.dDateOfBirth.ToString("dd/MM/yyyy")),
                                     Passport = c.cNumber
                                 }).ToList();
            this.DataSource = OffCrewList;
            this.txtChucDanh.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
            new DevExpress.XtraReports.UI.XRBinding("Text", null, "cRankName")});
            this.txtTen.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
            new DevExpress.XtraReports.UI.XRBinding("Text", null, "FullName")});
            this.txtNgaySinh.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
            new DevExpress.XtraReports.UI.XRBinding("Text", null, "dDateOfBirth")});
            this.txtPassport.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
            new DevExpress.XtraReports.UI.XRBinding("Text", null, "Passport")});
        }

        private void txtTen_Draw(object sender, DrawEventArgs e)
        {

        }

        private void txtTen_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            txtTen.Text = Ultilities.RemoveSign4VietnameseString(txtTen.Text);
        }
        int _stt = 0;
        private void txtSTT_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            _stt++;
            txtSTT.Text = "(" + _stt + ")";

        }
    }
}
